package com.yuyou.tas.admin.service.impl;

import com.yuyou.tas.admin.mapper.AuthOrganizationSubSecMapper;
import com.yuyou.tas.admin.service.IAuthOrganizationSubSecService;
import com.yuyou.tas.service.api.admin.entity.AuthOrganizationSubSec;
import com.yuyou.tas.util.bean.ResBoolSimpleInfo;
import com.yuyou.tas.util.tool.Sequence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AuthOrganizationSubSecServiceImpl implements IAuthOrganizationSubSecService{

	@Autowired
	private AuthOrganizationSubSecMapper authOrganizationSubSecMapper;
	
	@Override
	public int deleteByPrimaryKey(Long id) {
		return authOrganizationSubSecMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(AuthOrganizationSubSec record) {
		record.setId(Sequence.getSequence().nextId());
		record.setCreateTime(new Date());
		return authOrganizationSubSecMapper.insert(record);
	}

	@Override
	public AuthOrganizationSubSec selectByPrimaryKey(Long id) {
		return authOrganizationSubSecMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(AuthOrganizationSubSec record) {
		return authOrganizationSubSecMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public ResBoolSimpleInfo<String> add(AuthOrganizationSubSec record) {
		this.insert(record);
		return ResBoolSimpleInfo.getSuccessInfo();
	}

	@Override
	public ResBoolSimpleInfo<String> delByOrganId(Long authOrganizationId) {
		return null;
	}

	@Override
	public void delAllByOrganId(Long organId) {
		authOrganizationSubSecMapper.delAllByOrganId(organId);
	}

	@Override
	public List<AuthOrganizationSubSec> getAllByOrganId(Long organId) {
		return authOrganizationSubSecMapper.getAllByOrganId(organId);
	}

}